<?php
/**
 *============================
 * author:Farmer
 * time:2018/8/18 22:01
 * blog:blog.icodef.com
 * function:
 *============================
 */
require_once 'config.php';
if (!defined('IN_DISCUZ')) {
    exit('Access Denied');
}
define('PLUGIN_NAME', 'huanl_withdraw_money');
global $_G;
if (!$_G['uid']) {
    exit('Permission denied');
}
$action = isset($_GET['action']) ? $_GET['action'] : '';
if ($action) {
    echo call_user_func($action);
}

function get_credit_number() {
    return getuserprofile('extcredits' . $_GET['credit_index']);
}

function get_credit_type() {
    $ret = [];
    foreach ($_POST['tid'] as $key => $value) {
        $row = DB::fetch_first('select * from ' .
            DB::table('reward_credit') . ' where tid=%d',
            [$value]);
        if ($row) {
            $ret[$key] = $row['ctype'];
        }
    }
    return json_encode($ret);
}